package com.design.behavior.command.cainiao;

import java.util.ArrayList;
import java.util.List;

/**
 * @ProjectName: design
 * @Package: com.design.behavior.command.cainiao
 * @ClassName: Broker
 * @Author: shenaiguo
 * @Description:创建命令调用类。
 * @Date: 2020/10/1 0001 10:59
 */
// 步骤4
public class Broker {
    private List<Order> orderList = new ArrayList<Order>();

    public void takeOrder(Order order){
        orderList.add(order);
    }

    public void placeOrders(){
        for (Order order : orderList) {
            order.execute();
        }
        orderList.clear();
    }
}
